<?php
/**
 * Created by PhpStorm.
 * User: dust2
 * Date: 14-11-29
 * Time: 上午10:17
 */
class Cart extends Eloquent
{
    public static function getProducts($products)
    {
        $list = [];
        $columns = ['id', 'name', 'price', 'image', 'amount'];
        foreach ($products as $product_id => $attribute) {
            $product = Product::select($columns)->findOrFail($product_id)->toArray();
            $product = array_merge($product, $attribute);
            array_push($list, $product);
        }
        return $list;
    }
}